package service

import (
	"gcopyright/repositories"
	"github.com/kataras/iris"
)

type LoginService struct {
	ctx iris.Context
}

func NewLoginService(c iris.Context) *LoginService {
	return &LoginService{ctx: c}
}

func (l *LoginService) Login(sql *repositories.RepositoriesSqlite) int {
	s := l.ctx.URLParam("user")

	if sql.LoginQuery(s).Password == l.ctx.URLParam("password") {
		return 1
	} else {
		return 0
	}
}
